home *** CD-ROM | disk | FTP | other *** search
- Path: news.nyu.edu!schonberg!dewar
- From: dewar@cs.nyu.edu (Robert Dewar)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu
- Subject: Re: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada)
- Date: 9 Apr 1996 21:57:00 -0400
- Organization: Courant Institute of Mathematical Sciences
- Message-ID: <dewar.829101156@schonberg>
- References: <JSA.96Feb16135027@organon.com> <dewar.828936837@schonberg> <828964950snz@genesis.demon.co.uk> <dewar.828987544@schonberg> <4kbuebINNrho@keats.ugrad.cs.ubc.ca> <dewar.829048603@schonberg> <4kets3$ic0@news-s01.ny.us.ibm.net>
- NNTP-Posting-Host: schonberg.cs.nyu.edu
- X-Newsreader: NN version 6.5.0 (NOV)
-
- Mike said
-
- "SIGSEGV is invited, not by any "statement of semantics", but by careless
- code. If you use these functions without reasonable care, then you
- experience the consequences. If you do this for a living, you learn not
- to waste time on unnecessary chances."
-
- No, that's confused. First of all, the clear specifications of most
- specific systems, e.g. SunOS, GUARANTEE *not* to give a sigsegv for
- the call in question. Linux may or may nt give a SIGSEGV depending
- on the luck of the draw (where the buffer is in memory).
-
- Basically the original code (not mine incidentally, I never write in
- C these days), was taking a short cut that was reasonably safe on
- most systems, and this "bug" might have survived for ever in the
- absence of the check in Linux + the happenstance that the buffr
- was near the end of memory.
-
- True, if someone appended to the file while it was being compiled,
- disaster could have struck, but most compilers and assemblers
- tend to assume that this is unlikely and of course in systems
- with decent file protection it is impossible. So for example,
- the code as originally written is 100% reliable on OS/2.
-
- Of course writing portable code requires careful consideration
- of various possibilities, and failure to be careful certainly
- results in portability problems. But it is clear that if the
- spec for read had been clearer, this bug would NOT have been
- present in the first place!
-
-